﻿using System;
using System.Windows.Forms;
using Inovout.Gis.Geometry;
using Inovout.Gis;
using Inovout.Gis.Land;
using Inovout.ArcGis;

namespace ArgGisUI
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
   
            GeometryFactory.RegiesterGeometryFactory(new LandGeometryFactory());
            LayerFactory.RegiesteLayerFactory(new LandLayerFactory());
             RepositoryFactory.GisInfoRepositoryFactory = new ArcGisInfoRepositoryFactory();
            StoreLayerDescritor();

            Application.Run(new MainForm());
       
        }

        private static void StoreLayerDescritor()
        {
            //string fileName=typeof(MapTopology).Name+".layer";
            //if(File.Exists(fileName))
            //{
            //    File.Delete(fileName);
            //}
            MapTopology mapTopology = new MapTopology();
            LayerDescriptor tubanLayer = new LayerDescriptor { Name = "基期现状", LayerType = LayerType.Group };
            tubanLayer.Layers.Add(new LayerDescriptor { Name = "G31_H_PY", LayerType = LayerType.Polygon });
            tubanLayer.Layers.Add(new LayerDescriptor { Name = "G32_H_PL", LayerType = LayerType.Line });
            tubanLayer.Layers.Add(new LayerDescriptor { Name = "G33_H_PT", LayerType = LayerType.Point });
            mapTopology.Store();
        }

    }
}
